How to get value of device capability
In This Topic
Example: Here is an example that shows how to get information about all pixel types supported by the device.
Private VSTwain1 As New VintaSoftTwain()
Private Sub GetPixelTypeInfos()
' open the device manager
If Not VSTwain1.DeviceManager_Open() Then
Console.WriteLine(VSTwain1.errorString)
Exit Sub
End If
' open the device
If Not VSTwain1.Device_Open Then
Console.WriteLine(VSTwain1.errorString)
Exit Sub
End If
' specify that we will work with ICAP_PIXELTYPE capability
VSTwain1.Device_Cap_Id = 257 ' ICAP_PIXELTYPE
' if capability is supported
If VSTwain1.Device_Cap_IsSupported() Then
' specify container type for capability value
VSTwain1.Device_Cap_ValueContainerType = DEVICECAPABILITYVALUECONTAINERTYPE.DEVICECAPABILITYVALUECONTAINERTYPE_Enum
' get capability value
VSTwain1.Device_Cap_Get()
' print current capability value
Console.WriteLine(String.Format("Current value: {0}", VSTwain1.Device_Cap_Value))
' if capability container contains information about values supported by capability
If VSTwain1.Device_Cap_ValueContainerType = DEVICECAPABILITYVALUECONTAINERTYPE.DEVICECAPABILITYVALUECONTAINERTYPE_Array Or _
VSTwain1.Device_Cap_ValueContainerType = DEVICECAPABILITYVALUECONTAINERTYPE.DEVICECAPABILITYVALUECONTAINERTYPE_Enum Then
' output supported values
Console.Write("Value items: ")
Dim capItems() As Single = VSTwain1.Device_Cap_Items
For i = LBound(capItems) To UBound(capItems)
Console.Write(String.Format("{0} ", capItems(i)))
Next i
End If
End If
' close the device
VSTwain1.Device_Close()
' close the device manager
VSTwain1.DeviceManager_Close()
End Sub